<template>
  <div>
    <div class="centerkan">
      <span @click="goMachete">全民砍价></span>
    </div>
    <van-card
      v-for="(item, index) in list"
      :key="index"
      :desc="item.characteristic"
      :title="item.name"
      :thumb="item.pic"
      v-show="index < 2"
      @click="goshopcar(item)"
    >
      <template #tags @click="goshopcar(item)">
        <div>
          <div class="dv1">
            <span class="sp1">{{ item.minPrice }}</span>
            <span>{{ item.originalPrice }}</span>
            <span>{{ item.stores }}件</span>
          </div>
          <br />
          <div class="dv1">
            <span>低价</span>
            <span>原价</span>
            <span>限量</span>
          </div>
        </div>
      </template></van-card
    >
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [],
      page: 1,
      pageSize: 3,
    };
  },
  mounted() {
    this.$API.getStoreList().then((res) => {
      this.list = res.data.data;
      this.list = this.list.slice(5, 8);
      // console.log(res.data.data);
    });
    // this.$API.login().then((res)=>{
    //   console.log(res);
    // }).catch((error)=>{
    //   console.log(error);
    // })
    // this.$axios.get("https://api.it120.cc/small4/shop/goods/list",{page:this.page,pageSize:this.pageSize}).then((res)=>{
    //     // this.list=res
    //     console.log(res.data.data);
    // })
  },
  methods: {
    goMachete() {
      this.$router.push("/shoukan");
    },
   goshopcar(item) {
      this.$router.push({ path: "/shopcar", query: { id:item.id } });
    },
  },
};
</script>

<style lang="scss" scoped>
.centerkan {
  height: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  span {
    font-size: 1rem;
  }
}
.dv1 {
  display: flex;
  justify-content: space-around;
  // flex-wrap: wrap;
}
.sp1 {
  color: red;
  font-weight: 700;
}
</style>